package com.nl.lib_project.view.dialog

import android.app.Presentation
import android.content.Context
import android.os.Bundle
import android.view.Display
import android.view.View
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.constraintlayout.utils.widget.ImageFilterView
import com.nl.lib_core.tool.extends.visible
import com.nl.lib_project.R
import com.nl.lib_project.view.CustomProgressBar

/** 作者:LiBW 创建日期:2022/7/18 描述:副屏展示Dialog */
class SecondScreenDialog(
    context: Context,
    display: Display,
    private val view: View,
) : Presentation(context, display) {
  private var mTitleTV: TextView? = null
  private val mProgressTV: TextView by lazy { findViewById(R.id.tv_topic_number) }
  private val mProgressBar: CustomProgressBar by lazy { findViewById(R.id.progress_bar) }
  private val mExitIV: ImageFilterView by lazy { findViewById(R.id.iv_back) }
  private val mContainer: RelativeLayout by lazy { findViewById(R.id.mContainer) }

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.dialog_second_screen)
    mTitleTV = findViewById(R.id.toolbar_title)
    mExitIV.setOnClickListener {}
  }

  /** 设置进度 */
  fun setProgress(str: String) {
    mProgressBar.visible()
    mProgressTV.text = str
  }
  /** 设置标题 */
  fun setTitleText(str: String?) {
    mTitleTV?.text = str ?: ""
  }

  /** 添加布局 */
  fun setView(view: View) {
    mContainer.removeAllViews()
    mContainer.addView(view)
  }
}
